package com.hzdl.flower.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.flower.bean.Admin;
import com.hzdl.flower.bean.Flower;
import com.hzdl.flower.mapper.AflowerMapper;
import com.hzdl.flower.mapper.FlowerMapper;
import com.hzdl.flower.service.AflowerService;
import com.hzdl.flower.vo.FlowerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AflowerServiceImpl implements AflowerService {
    @Autowired
    private AflowerMapper afm;

    @Override
    public PageInfo<Flower> findFlower(FlowerVo flowerVo) {
        PageHelper.startPage(flowerVo.getPage(), flowerVo.getLimit());
        List<Flower> fllower = afm.findFllower(flowerVo);
        PageInfo pageInfo = new PageInfo(fllower);
        return pageInfo;
    }

    @Override
    public int addFlower(FlowerVo flowerVo) {
        return afm.addFlower(flowerVo);
    }

    @Override
    public int deleteFlower(Integer id) {
        return afm.deleteFlower(id);
    }

    @Override
    public int updateFlower(FlowerVo flowerVo) {
        return afm.updateFlower(flowerVo);
    }

    @Override
    public Flower findById(String id) {
        return afm.findById(id);
    }
}
